package cn.oowoo.jsr303.common.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;
import java.util.List;

@Data
public class JSR303TestDto {

    @NotNull(message = "id不能为空")
    private Integer id;

    @NotBlank
    @Size(min = 2,max = 8,message = "姓名必须是2-8位长度")
    private String name;

    @Range(min=18,max=150,message = "年龄必须在18-150岁之间")
    private Integer age;

    @Range(min = 0,max = 1,message = "性别只能是0：女，或者1：男")
    private Integer sex;

    @Pattern(regexp = "^((17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$",message = "手机号码不合法")
    private String phone;

    @Email(message = "邮箱不合法")
    private String email;

    @Size(min = 2,message = "必须选择两个以上的爱好")
    private List<String> favorites;

    @Range(min=0,max=1,message = "只能接收1或者0")
    private Integer enable;
}
